package com.haoshuang.zhouzhoubang.ui.page.help.login

import com.haoshuang.zhouzhoubang.model.api.ApiRepo
import com.haoshuang.zhouzhoubang.model.bean.LoginHelpTelBean
import com.mufeng.libs.base.BaseViewModel
import com.mufeng.libs.net.ResponseBean
import com.mufeng.libs.net.netRequest
import com.mufeng.libs.state.StateData
import com.mufeng.libs.state.StatefulMutableLiveData


class LoginHelpViewModel : BaseViewModel() {

    /**
     * 加载数据
     */
    val loginHelpListData = StatefulMutableLiveData<ResponseBean<LoginHelpTelBean>>()
    fun loginHelpList() = netRequest {
        start { loginHelpListData.value = StateData.Loading }
        request { ApiRepo.loginHelpList()  }
        success { loginHelpListData.value = StateData.Success(it) }
        error { code, msg ->
            loginHelpListData.value = StateData.Error(code, msg)
        }
    }

}